import Config from "../main.config";
import Ajax from "../utils/Ajax";
import {setStorageSync} from "../utils/Storage";
module.exports = {

    /*
    * 获取banner图
    * */
    getBanners: async function () {
        let url = Config.api.studentBanner;
        let res =  await Ajax.request({
            method: "POST",
            url
        });
        return res.map(function (item) {
            return {
                type: item.type,
                src: Config.api.downLoad + "?fileId=" + item.images,
                toUrl: item.advertisement
            }
        })
    },

    /*
    * 获取员工信息详情
    * */
    getRegisterDetail: async function (createUser) {
        let url = Config.api.studentDetail;
        let res = await Ajax.request({
            method: "POST",
            url,
            data: {
                createUser
            }
        });
        setStorageSync(Config.storage.registerInfo, res);
        return res
    },

    /*
    * 创建员工
    * */
    createUser: async function (data) {
        let url = Config.api.studentCreate;
        return await Ajax.request({
            method: "POST",
            url,
            data
        })
    },

    /*
    * 编辑员工信息
    * */
    editUser: async function (data) {
        let url = Config.api.studentEdit;
        return await Ajax.request({
            method: "POST",
            url,
            data
        })
    },

    /*
    * 获取校友列表
    * */
    getAlumniList: async function (data = {}) {
        let url = Config.api.studentAlumniList;
        return await Ajax.request({
            method: "POST",
            url,
            data
        })
    },

    /*
    * 获取届列表
    * */
    getStudentGrades: async function () {
        let url = Config.api.studentGrades;
        return Ajax.request({
            method: "POST",
            url
        })
    },

    /*
    * 添加简历
    * */
    addResume: async function (data = {}) {
        let url = Config.api.studentResumeAdd;
        return Ajax.request({
            method: "POST",
            url,
            data
        })
    },

    /*
    * 删除简历
    * */
    delResume: async function (id) {
        let url = Config.api.studentResumeDel;
        return Ajax.request({
            method: "POST",
            url,
            data: {id}
        })
    },

    /*
    * 获取简历列表
    * */
    getResumeList: async function (data = {}) {
        let url = Config.api.studentResumeList;
        return Ajax.request({
            method: "POST",
            url,
            data
        })
    }
}